contract
Smart Contract Deployment
For deploying a smart contract, you can not only use the tronWeb.transactionBuilder.createSmartContract interface, but also the tronWeb.contract().new() interface.
Smart Contract Invocation
Get smart contract instance
Before calling a smart contract, you need to obtain the smart contract instance first. You can create a contract instance in the following two ways:
//Example 1
let abi = [...];
let instance = await tronWeb.contract(abi,'contractAddress');
//Example 2
let abi = [...];
let instance = await tronWeb.contract(abi, 'contractAddress');
Calling smart contract methods
Different types of contract methods need to be invoked by different tronweb apis:
- Use
call
to executepure
orview
smart contract methods, please refer to method.call(). - Use
send
to executenon-pure
ormodify
smart contract methods, please refer to method.send() for specific usage instructions.